#pragma once

/*
@author: TriLVH
@description: Bullet entity
*/

#include "AbstractEntity.h"
#include "BulletData.h"	
#include "BulletBehavior.h"

class BulletEntity : public AbstractEntity {
private:
	/* Data of entity */
	BulletData* _data;
	/* Behavior of entity */
	BulletBehavior* _behavior;

public:
	/* Constructor to init data */
	BulletEntity(int id, int type, double x, double y, int direction, Rect* actor, Rect* target, BulletArmies bulletArmy, bool isHalf, int distanceForLive);

	/* Fire check vx, vy  */
	void fire();

	/* Implement all abstract function */

	/* Update state, pos of bullet */
	virtual void update(long time);

	/* Set bullet behavior */
	void setBulletBehavior(BulletBehavior* behavior);

	BulletData* getBulletData();

	/* Draw bullet with current state */
	virtual void draw(long time);

	/* Get data of entity */
	virtual AbstractData* getAbstractData();

	/* Init data of entity */
	virtual void initData();

	/* Overload init data */
	virtual void initData(Rect* actorRect, Rect* targetRect);

	~BulletEntity();

	virtual void updateData(int action, int action_data);

	virtual bool checkAlive();
};